#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QMessageBox>
#include <QStringList>
#include "codetype.h"
#include <QImage>
#include <QTcpServer>
#include <QTcpSocket>
#include <QFileDialog>


QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    QSerialPort *serialPort;
    QImage *img;
    QImage *imgGrey;
    QTcpServer *tcpServer;
    QTcpSocket *tcpSocket;
    QString saveFileName;
    QString fileName;
    QTime qTime;
private slots:
    void on_openButton_clicked();

    void on_closeButton_clicked();

    void on_sendButton_clicked();

    void on_clearReceive_clicked();

    void on_readyRead();
    void on_checkProtocol_stateChanged(int arg1);

    void on_TcpOnButton_clicked();

    void new_client();
//    void read_client_data();
    void server_dis();
    void read_server_data();
    void connect_suc();
    void client_dis();
    void on_tcpoffButton_clicked();
    void on_tcpProtocol_currentIndexChanged(int index);

    void on_comProtocol_currentIndexChanged(int index);
    void on_refreshButton_clicked();

    void on_savePathButton_clicked();
private:
    Ui::Widget *ui;

};
#endif // WIDGET_H
